<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>简介</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="book.mysqlnd-mux.html">mysqlnd_mux</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlnd-mux.concepts.html">Concepts</a></div>
 <div class="up"><a href="book.mysqlnd-mux.html">mysqlnd_mux</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="intro.mysqlnd-mux" class="preface">
  <h1 class="title">简介</h1>
  <p class="para">
   The mysqlnd multiplexing plugin (<em>mysqlnd_mux</em>)
   multiplexes MySQL connections established by all PHP MySQL extensions 
   that use the MySQL native driver (<a href="book.mysqlnd.html" class="link">mysqlnd</a>)
   for PHP.
  </p>
  <p class="para">
   The MySQL native driver for PHP features an internal C API for plugins,
   such as the connection multiplexing plugin, which can extend the functionality of
   mysqlnd. See the <a href="book.mysqlnd.html" class="link">mysqlnd</a> for additional details
   about its benefits over the MySQL Client Library libmysqlclient.
  </p>
  <p class="para">
   Mysqlnd plugins like <em>mysqlnd_mux</em> operate, for the most part,
   transparently from a user perspective. The connection multiplexing
   plugin supports all PHP applications, and all MySQL PHP extensions.
   It does not change existing APIs. Therefore, it can easily be used with
   existing PHP applications.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
     This is a proof-of-concept. All features are at an early stage. Not all
     kinds of queries are handled by the plugin yet. Thus, it cannot be used
     in a drop-in fashion at the moment.
    </p>
    <p class="para">
      Please, do not use this version in production environments.
    </p>
  </p></blockquote>
  <div class="section" id="mysqlnd-mux.key-features">
   <h2 class="title">Key Features</h2>
   <p class="para">
    The key features of mysqlnd_mux are as follows:
   </p>
   <p class="para">
    <ul class="itemizedlist">
     <li class="listitem">
      <p class="para">
       Transparent and therefore easy to use:
      </p>
      <p class="para">
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          Supports all of the PHP MySQL extensions.
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          Little to no application changes are required, dependent on the required usage scenario.
         </p>
        </li>
       </ul>
      </p>
     </li>

     <li class="listitem">
      <p class="para">
       Reduces server load and connection establishment latency:
      </p>
      <p class="para">
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
           Opens less connections to the MySQL server.
         </p>
        </li>
        <li class="listitem">
         <p class="para">
           Less connections to MySQL mean less work for the MySQL server.
           In a client-server environment scaling the server is often more
           difficult than scaling the client. Multiplexing helps with
           horizontal scale-out (scale-by-client).
         </p>
        </li>
        <li class="listitem">
         <p class="para">
           Pooling saves connection time.
         </p>
        </li>
        <li class="listitem">
         <p class="para">
           Multiplexed connection: multiple user handles share the
           same network connection. Once opened,
           a network connection is cached and shared among
           multiple user handles. There is a 1:n relationship between
           internal network connection and user connection handles.
         </p>
        </li>
        <li class="listitem">
         <p class="para">
           Persistent connection: a network connection is kept open
           at the end of the web request, if the PHP deployment model allows.
           Thus, subsequently web requests can reuse a
           previously opened connection. Like other resources, network
           connections are bound to the scope of a process. Thus, they can
           be reused for all web requests served by a process.
         </p>
        </li>
       </ul>
      </p>
     </li>

    </ul>
   </p>
  </div>

  <div class="section" id="mysqlnd-mux.limitations">
   <h2 class="title">Limitations</h2>
   <p class="para">
    The proof-of-concept does not support unbuffered queries, prepared
    statements, and asynchronous queries.
   </p>
   <p class="para">
    The connection pool is using a combination of the transport method and
    hostname as keys. As a consequence, two connections to the same
    host using the same transport method (TCP/IP, Unix socket, Windows named pipe)
    will be linked to the same pooled connection even if username and
    password differ. Be aware of the possible security implications.
   </p>
   <p class="para">
    The proof-of-concept is transaction agnostic. It does not know about SQL
    transactions.
   </p>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     Applications must be aware of the consequences of connection sharing connections.
    </p>
   </p></blockquote>
  </div>

  <div class="section" id="mysqlnd-mux.name">
   <h2 class="title">About the name mysqlnd_mux</h2>
   <p class="para">
    The shortcut <em>mysqlnd_mux</em>
    stands for <em>mysqlnd connection multiplexing plugin</em>.
   </p>
  </div>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="book.mysqlnd-mux.html">mysqlnd_mux</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlnd-mux.concepts.html">Concepts</a></div>
 <div class="up"><a href="book.mysqlnd-mux.html">mysqlnd_mux</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
